<% view = FormView.new(subject: @assignment) %>

<dl class="<%= view.form_class_for(:title) %>">
  <dt><%= f.label :title %></dt>
  <dd><%= f.text_field :title, class: 'textfield form-control input-contrast input-block' %></dd>
  <%= render('shared/form_error', errors: view.error_message_for(:title)) if view.errors_for?(:title) %>
</dl>

<dl class="<%= view.form_class_for(:slug) %>">
  <dt><%= f.label :slug %></dt>
  <dd><%= f.text_field :slug, class: 'textfield form-control input-contrast input-block' %></dd>
  <%= render('shared/form_error', errors: view.error_message_for(:slug)) if view.errors_for?(:slug) %>
  <span class="note"><%= t('assignment_form.slug_note') %></span>
</dl>

<dl class="<%= view.form_class_for(:public_repo) %>">
  <div class="form-checkbox">
    <label><%= f.radio_button :public_repo, true %> Public</label>
    <%= octicon 'repo', height: 32 %>
    <span class="note">Submit assignments using public repositories. All submissions will be visible to the world.</span>
  </div>

  <div class="form-checkbox">
    <label><%= f.radio_button :public_repo, false %> Private</label>
    <%= octicon 'lock', height: 32 %>
    <span class="note">Submit assignments using private repositories. Submissions will only be visible to the submitter and organization owners.</span>
  </div>

  <%= render('shared/form_error', errors: view.error_message_for(:public_repo)) if view.errors_for?(:public_repo) %>
</dl>

<dl class="form">
  <div class="form-checkbox">
    <label><%= f.check_box :students_are_repo_admins %> Give students Admin permissions on their repository</label>
  </div>
</dl>

<dl class="form">
  <dt><label>Add your starter code from GitHub <small>(optional)</small> </label></dt>
  <dd><input class="textfield js-autocomplete-textfield form-control input-contrast input-block" type="text" name="repo_name" value="<%= @assignment.starter_code_repository.try(:full_name) %>" placeholder="<%= @assignment.starter_code_repository.try(:full_name) || 'Search repositories'%>" autocomplete="off" data-autocomplete-search-endpoint="github_repos"></dd>
  <dd class="dd-autocomplete-suggestions"><%= render_autocomplete_suggestions_container %></dd>
  <input class="js-autocomplete-resource-id" type="hidden" name="repo_id" />
</dl>

<dl class="<%= view.form_class_for(:deadline) %>">
  <dt><label>Deadline <small>(optional)</small></label></dt>
  <dd><%= f.text_field :deadline, class: 'jquery-datetimepicker form-control input-contrast input-block', value: DeadlineFormatHelper.convert(f.object.deadline) %></dd>
  <%= render('shared/form_error', errors: view.error_message_for(:deadline)) if view.errors_for?(:deadline) %>
  <span class="note">After the deadline, GitHub Classroom will save the latest commit from each repo as a submission. Submission commits are viewable on the assignment page.</span>
</dl>
